package com.servlet.book;

import com.enitiy.Book;
import com.service.book.BookServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 创建作者 ：MySunshine
 * 创建时间 2022/10/28 17:02
 * 项目名称 SHUSHAN
 */
@WebServlet("/BookSelectAllToMian")
public class BookSelectAllToMian extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


        BookServiceImpl bsi = new BookServiceImpl();
        List<Book> books = bsi.SelectBookAll();
        if (books!=null){
            System.out.println(" kid "+books);
            System.out.println("查询成功");
            req.getSession().setAttribute("book",books);
            req.getRequestDispatcher("/page/book/bookSelectAll.jsp").forward(req,resp);
        }
    }
}
